/*****************************
#include "stdio.h"
#include "conio.h"
#include "iostream"
using namespace std;
#define n 100

int s[n];
int t;

void init()
{
	t=0;
}



char isEmpty()
{
	if(t==0) return 1;
	return 0;
}

char isFull()
{
	if(t>=n) return 1;
	return 0;
}

//Them mot phan tu x vao Stack s

void push(int x)
{
	if(t<n) //Stack chua day
	{
		s[t]=x;
		t ++;
	}
	else
		puts("\nStack day");
}

//Trich thong tin va huy phan tu o dinh Stack s

int pop()
{
	int x;
	if(t>0) //Stack khac rong
	{
		t --;
		x=s[t];
		return x;
	}
	else
	{
		puts("\nStack rong");
		return -1;
	}
}

//Xem thong tin cua phan tu o dinh Stack s

int top()
{
	int x;
	if(t>0) //Stack khac rong
	{
		x=s[t-1];
		return x;
	}
	else
	{
		puts("\nStack rong");
		return -1;
	}
}

void main()
{

	init();
	int x;
	while(1)
	{
		cout<<"\nBan co muon them pt vao Stack khong ?";
		char kt=getch();
		if(kt=='n') break;
		cout<<"\nNhap phan tu ban muon them:";
		cin>>x;
		push(x);
	}
	cout<<"\nSo phan tu cua Stack:"<<t;
	int to=top();
	if(to!=-1)
		cout<<"\nGia tri phan tu dau Stack la:"<<to<<"\n";
	else
		cout<<"\nStack rong";
	int kq;
	while(!isEmpty())
	{
		kq=pop();
		cout<<kq<<"\t";
	}
}

/*****************************/
